#ifndef EVENTSYSTEM_H
#define EVENTSYSTEM_H

#include "Event.h"
#include "EventListener.h"

#include <queue>
#include <map>
using std::multimap;
using std::pair;
using std::queue;
using std::make_pair;

typedef void (*EventHandler)(Event* _event);

class EventSystem
{
private:
	static multimap<EVENTID, EventHandler>	clientDatabase;
	static queue<Event>							currentEvents;

	static void DispatchEvent(Event* _event);
	static bool IsAlreadyRegistered(EVENTID _eventID, EventHandler _client);

public:
	static void RegisterClient(EVENTID _eventID, EventHandler _client);
	static void UnregisterClient(EVENTID _eventID, EventHandler _client);
	static void UnregisterClientAll(EventHandler _client);
	static void SendEvent(EVENTID _eventID, void* _data = NULL);
	static void ProcessEvents();
	static void ClearEvents();
	static void ShutdownEventSystem();

};

#endif